home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / PROGTOOL / PMODE24.ZIP;1 / EXAMPLES.ZIP / EX_PM4.ASM < prev    next >
Encoding:
Assembly Source File  |  1994-02-05  |  4.6 KB  |  140 lines

  1. ; This program uses the KB and VGA50 libs.
  2.  
  3.         .386p
  4. code32  segment para public use32
  5.         assume cs:code32, ds:code32
  6.  
  7. include pmode.inc
  8. include vga50.inc
  9. include kb.inc
  10.  
  11. public  _main
  12.  
  13. ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
  14. ; DATA
  15. ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
  16.  
  17. msg0            db      'Press any key to go on.',0
  18. msg1            db      'Press and release keys, and watch the contents of _kbtbl0.',0
  19. msg2            db      'ESC to exit.',0
  20. msg3            db      'Any key to exit to DOS.',0
  21.  
  22. textboxborders  db      'ƒ≥⁄ø¿Ÿ '
  23.  
  24. ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
  25. ; CODE
  26. ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
  27.  
  28. ;ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕ
  29. _main:
  30.         sti
  31.  
  32.         call _initkb                    ; init KB handler
  33.         call _initvga50                 ; init VGA 80x50 text mode
  34.  
  35.         mov al,'±'                      ; box filled with ± character
  36.         mov ah,8                        ; grey on black
  37.         mov bl,0                        ; at X=0
  38.         mov bh,0                        ; and Y=0
  39.         mov cl,80                       ; width 80
  40.         mov ch,50                       ; height 50
  41.         call _textbox0                  ; put text box
  42.  
  43.         mov bl,0
  44.         mov bh,0
  45.         mov cl,80
  46.         mov ch,1
  47.         call _pushtext                  ; save area of 80x1 at 0,0
  48.  
  49.         mov ah,15                       ; bright white on black
  50.         mov edx,offset msg0
  51.         call _putstr                    ; put string at 0,0
  52.  
  53.         call _getch                     ; wait for a keypress
  54.  
  55.         mov ah,15                       ; bright white on black
  56.         mov edx,offset msg1
  57.         call _putstr                    ; put new string there
  58.  
  59.         mov bl,10                       ; X=10
  60.         mov bh,13                       ; Y=13
  61.         mov cl,22                       ; width 22
  62.         mov ch,15                       ; height 14
  63.         call _pushtext                  ; save this area
  64.  
  65.         mov ah,7
  66.         mov edx,offset textboxborders
  67.         call _textbox1                  ; put text box with borders
  68.  
  69.         mov ah,14                       ; yellow on black
  70.         add bl,2                        ; X=X+2 (10+2)
  71.         add bh,1                        ; Y=Y+2 (13+2)
  72.         mov edx,offset msg2
  73.         call _putstr                    ; put string there
  74.  
  75.         mov ah,7
  76.         add bh,2
  77.         mov cl,18
  78.         mov ch,10
  79.         mov edx,offset textboxborders
  80.         call _textbox1                  ; put text box with borders
  81.  
  82. ; now continuously update the 16x8 area at 13,17 with the contents of _kbtbl0.
  83.  
  84. ml0:
  85.         mov edi,0b8000h+160*17+2*13     ; get ptr to screen at 13,17
  86.         sub edi,_code32a
  87.  
  88.         mov esi,offset _kbtbl0          ; get ptr to _kbtbl0
  89.  
  90.         mov bh,8                        ; first loop counter, 8 repetitions
  91. ml1:
  92.         mov bl,16                       ; second loop counter
  93. ml2:
  94.         mov al,' '                      ; store a blank space by default
  95.         cmp byte ptr [esi],0            ; is key depressed?
  96.         je short ml2f0
  97.         mov al,'€'                      ; yes, so store a € instead
  98. ml2f0:
  99.         mov [edi],al                    ; put it to vidmem
  100.  
  101.         inc esi                         ; increment loc in _kbtbl0 and vidmem
  102.         add edi,2
  103.  
  104.         dec bl                          ; dec loop counter and loop if needed
  105.         jnz ml2
  106.  
  107.         add edi,2*(80-16)               ; adjust to next position in vidmem
  108.         dec bh                          ; dec loop counter and loop if needed
  109.         jnz ml1
  110.  
  111.         cmp _kbhit,0                    ; a valid key hit?
  112.         je ml0
  113.  
  114.         call _getch                     ; get it
  115.         cmp al,14                       ; loop if not an ESC
  116.         jne ml0
  117.  
  118.         call _poptext                   ; restore 22x14 area at 10,13
  119.         call _poptext                   ; restore 80x1 area at 0,0
  120.  
  121.         mov ah,15
  122.         mov bl,0
  123.         mov bh,20
  124.         mov edx,offset msg3
  125.         call _putstr                    ; put last message at 0,20
  126.  
  127.         call _getch                     ; wait for keypress
  128.  
  129.         mov v86r_ax,3                   ; return to normal text mode 3
  130.         mov al,10h
  131.         int 33h
  132.  
  133.         call _resetkb                   ; reset KB handler
  134.  
  135.         jmp _exit
  136.  
  137. code32  ends
  138.         end
  139.  
  140.